﻿using RedisLogQueueTest.CommonFunc;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RedisLogQueueTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            RedisLogQueueTest.CommonFunc.LogQueueConfig.RegisterLogQueue();//启动日志队列
        }

        private void btnRandom_Click(object sender, EventArgs e)
        {
            Random random = new Random(Convert.ToInt32(DateTime.Now.ToString("fff")));
            string longStr = random.Next(1000, 9999).ToString();

            LoggerFunc log = LoggerFactory.CreateLoggerInstance();
            log.SaveErrorLogTxT("您插入了一条随机数："+longStr);

            MessageBox.Show("插入成功");
        }

        private void btnDate_Click(object sender, EventArgs e)
        {
            string longStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            LoggerFunc log = LoggerFactory.CreateLoggerInstance();
            log.SaveErrorLogTxT("您插入了一条日期：" + longStr);

            MessageBox.Show("插入成功");
        }
    }
}
